package StudyCode.summary.mycollection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CopyCollection {
	public static void main(String[] argv) {
		Collection collection = java.util.Arrays.asList("科技与人文", "www.tah1986.com");
		System.out.println(copy(collection));
	}

	public static <T> List<T> copy(Collection<T> collection) {
		@SuppressWarnings("unchecked")
		List<T> ret = (List<T>) provideListFor(Object.class);
		ret.addAll(collection);
		return ret;
	}

	private static <T> List<T> provideListFor(Class<T> c) {
		return new ArrayList<T>();
	}
}
